package me.zhengjie.modules.system.rest.machine.zf;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.annotation.rest.AnonymousPostMapping;
import me.zhengjie.modules.system.domain.req.zf.*;
import me.zhengjie.modules.system.domain.rsp.BankRspDTO;
import me.zhengjie.modules.system.domain.rsp.CityRspDTO;
import me.zhengjie.modules.system.domain.rsp.zf.*;
import me.zhengjie.modules.system.service.zf.MerchantMachineService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/*
 *
 *
 * */
@RestController
@RequiredArgsConstructor
@Api(tags = "商户api")
@RequestMapping("/api/merchant")
public class MerchantMachineController {


    private final MerchantMachineService merchantMachineService;


    @Log("小微商户入网")
    @ApiOperation("小微商户入网")
    @AnonymousPostMapping("/smallMerchantNetworkAccess")
    public ResponseEntity<Boolean> smallMerchantNetworkAccess(@RequestBody SmallMerchantNetworkAccessReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.smallMerchantNetworkAccess(reqDTO), HttpStatus.OK);
    }


    @Log("商户终端绑定")
    @ApiOperation("商户终端绑定")
    @AnonymousPostMapping("/merchantTerminalBinding")
    public ResponseEntity<Boolean> merchantTerminalBinding(@RequestBody MerchantTerminalBindReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.merchantTerminalBinding(reqDTO), HttpStatus.OK);

    }

    @Log("商户终端解绑")
    @ApiOperation("商户终端解绑")
    @AnonymousPostMapping("/merchantTerminalUnBinding")
    public ResponseEntity<Boolean> merchantTerminalUnBinding(@RequestBody MerchantTerminalUnBindingReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.merchantTerminalUnBinding(reqDTO), HttpStatus.OK);

    }

    @Log("商户终端查询")
    @ApiOperation("商户终端查询")
    @AnonymousPostMapping("/queryMerchantTerminal")
    public ResponseEntity<List<QueryMerchantTerminalRspDTO>> queryMerchantTerminal(@RequestBody QueryMerchantTerminalReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.queryMerchantTerminal(reqDTO), HttpStatus.OK);

    }

    @Log("商户基本信息查询")
    @ApiOperation("商户基本信息查询")
    @AnonymousPostMapping("/queryMerchantBaseInfo")
    public ResponseEntity<QueryMerchantBaseInfoRspDTO> queryMerchantBaseInfo(@RequestBody QueryMerchantBaseInfoReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.queryMerchantBaseInfo(reqDTO), HttpStatus.OK);

    }

    @Log("商户费率信息查询")
    @ApiOperation("商户费率信息查询")
    @AnonymousPostMapping("/queryMerchantRateInfo")
    public ResponseEntity<QueryMerchantRateInfoRspDTO> queryMerchantRateInfo(@RequestBody QueryMerchantRateInfoReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.queryMerchantRateInfo(reqDTO), HttpStatus.OK);

    }

    @Log("商户结算信息查询")
    @ApiOperation("商户结算信息查询")
    @AnonymousPostMapping("/queryMerchantSettlementInfo")
    public ResponseEntity<QueryMerchantSettlementInfoRspDTO> queryMerchantSettlementInfo(@RequestBody QueryMerchantSettlementInfoReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.queryMerchantSettlementInfo(reqDTO), HttpStatus.OK);

    }

    @Log("小微商户基本信息修改")
    @ApiOperation("小微商户基本信息修改")
    @AnonymousPostMapping("/smallMerchantBaseInfoUpdate")
    public ResponseEntity<Boolean> smallMerchantBaseInfoUpdate(@RequestBody SmallMerchantBaseInfoUpdateReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.smallMerchantBaseInfoUpdate(reqDTO), HttpStatus.OK);

    }

    @Log("小微商户费率信息修改")
    @ApiOperation("小微商户费率信息修改")
    @AnonymousPostMapping("/smallMerchantRateInfoUpdate")
    public ResponseEntity<Boolean> smallMerchantRateInfoUpdate(@RequestBody SmallMerchantRateInfoUpdateReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.smallMerchantRateInfoUpdate(reqDTO), HttpStatus.OK);

    }

    @Log("小微商户结算信息修改")
    @ApiOperation("小微商户结算信息修改")
    @AnonymousPostMapping("/smallMerchantSettlementInfoUpdate")
    public ResponseEntity<Boolean> smallMerchantSettlementInfoUpdate(@RequestBody SmallMerchantSettlementInfoUpdateReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.smallMerchantSettlementInfoUpdate(reqDTO), HttpStatus.OK);

    }

    @Log("企业/个体户商户基本信息修改")
    @ApiOperation("企业/个体户商户基本信息修改")
    @AnonymousPostMapping("/businessMerchantBaseInfoUpdate")
    public ResponseEntity<Boolean> businessMerchantBaseInfoUpdate(@RequestBody BusinessMerchantBaseInfoUpdateReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.businessMerchantBaseInfoUpdate(reqDTO), HttpStatus.OK);

    }

    @Log("企业/个体户商户结算信息修改")
    @ApiOperation("企业/个体户商户结算信息修改")
    @AnonymousPostMapping("/businessMerchantSettlementInfoUpdate")
    public ResponseEntity<Boolean> businessMerchantSettlementInfoUpdate(@RequestBody BusinessMerchantSettlementInfoUpdateReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.businessMerchantSettlementInfoUpdate(reqDTO), HttpStatus.OK);

    }

    @Log("企业/个体户商户入网")
    @ApiOperation("企业/个体户商户入网")
    @AnonymousPostMapping("/businessMerchantNetworkAccess")
    public ResponseEntity<Boolean> businessMerchantNetworkAccess(@RequestBody BusinessMerchantNetworkAccessReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.businessMerchantNetworkAccess(reqDTO), HttpStatus.OK);

    }

    @Log("商户合并提现标识查询")
    @ApiOperation("商户合并提现标识查询")
    @AnonymousPostMapping("/merchantMergeWithdrawalQuery")
    public ResponseEntity<MerchantMergeWithdrawalQueryRspDTO> merchantMergeWithdrawalQuery(@RequestBody MerchantMergeWithdrawalQueryReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.merchantMergeWithdrawalQuery(reqDTO), HttpStatus.OK);

    }

    @Log("商户合并提现标识更新")
    @ApiOperation("商户合并提现标识更新")
    @AnonymousPostMapping("/merchantMergeWithdrawalUpdate")
    public ResponseEntity<MerchantMergeWithdrawalUpdateRspDTO> merchantMergeWithdrawalUpdate(@RequestBody MerchantMergeWithdrawalUpdateReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.merchantMergeWithdrawalUpdate(reqDTO), HttpStatus.OK);

    }


    @Log("商户钱包余额查询")
    @ApiOperation("商户钱包余额查询")
    @AnonymousPostMapping("/merchantWalletQuery")
    public ResponseEntity<MerchantWalletQueryRspDTO> merchantWalletQuery(@RequestBody MerchantWalletQueryReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.merchantWalletQuery(reqDTO), HttpStatus.OK);

    }

    @Log("商户待提现列表查询")
    @ApiOperation("商户待提现列表查询")
    @AnonymousPostMapping("/merchantWithdrawalsListQuery")
    public ResponseEntity<MerchantWithdrawalsListQueryRspDTO> merchantWithdrawalsListQuery(@RequestBody MerchantWalletQueryReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.merchantWithdrawalsListQuery(reqDTO), HttpStatus.OK);

    }

    @Log("商户合并提现申请")
    @ApiOperation("商户合并提现申请")
    @AnonymousPostMapping("/merchantMergerWithdrawalApplication")
    public ResponseEntity<Boolean> merchantMergerWithdrawalApplication(@RequestBody MerchantMergerWithdrawalApplicationReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.merchantMergerWithdrawalApplication(reqDTO), HttpStatus.OK);

    }

    @Log("商户合并提现结果查询")
    @ApiOperation("商户合并提现结果查询")
    @AnonymousPostMapping("/merchantWithdrawalQuery")
    public ResponseEntity<MerchantWithdrawalQueryRspDTO> merchantWithdrawalQuery(@RequestBody MerchantWithdrawalQueryReqDTO reqDTO) {
        return new ResponseEntity<>(merchantMachineService.merchantWithdrawalQuery(reqDTO), HttpStatus.OK);

    }


    @Log("查询省")
    @ApiOperation("查询省")
    @AnonymousPostMapping(value = "/queryProvince")
    public ResponseEntity<List<CityRspDTO>> queryArea(@RequestBody QueryProvinceReqDTO queryProvinceReqDTO) {
        return new ResponseEntity<>(merchantMachineService.queryArea(queryProvinceReqDTO), HttpStatus.OK);
    }

    @Log("查询市")
    @ApiOperation("查询市")
    @AnonymousPostMapping(value = "/queryCity")
    public ResponseEntity<List<CityRspDTO>> queryCity(@RequestBody @Validated QueryCityReqDTO queryProvinceReqDTO) {
        return new ResponseEntity<>(merchantMachineService.queryCity(queryProvinceReqDTO), HttpStatus.OK);
    }

    @Log("查询区县")
    @ApiOperation("查询区县")
    @AnonymousPostMapping(value = "/queryCounty")
    public ResponseEntity<List<CityRspDTO>> queryCounty(@RequestBody @Validated QueryCountyReqDTO queryCountyReqDTO) {
        return new ResponseEntity<>(merchantMachineService.queryCounty(queryCountyReqDTO), HttpStatus.OK);
    }

    @Log("查询银行")
    @ApiOperation("查询银行")
    @AnonymousPostMapping(value = "/queryBank")
    public ResponseEntity<List<BankRspDTO>> queryBank(@RequestBody @Validated QueryBankCardReqDTO queryCountyReqDTO) {
        return new ResponseEntity<>(merchantMachineService.queryBank(queryCountyReqDTO), HttpStatus.OK);
    }


}
